package jvmtest;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: Tom
 * @Date: 2022/01/18/11:03
 * @Description:
 */

import java.util.HashSet;
import java.util.Set;

/**
 *@ClassName RuntimeConstantPoolOOM
 *@Description
 *@Author 王琛
 *@Date 2022/1/18 11:03
 @Version 1.0
 */
public class RuntimeConstantPoolOOM {

    public static void main(String[] args) {
//        Set<String> set = new HashSet<>();
//        short i = 0;
//        while (true){
//            set.add(String.valueOf(i++).intern());
//        }
        String str1 = new StringBuilder("计算机").append("软件").toString();
        System.out.println(str1.intern() == str1);

        String str2 = new StringBuilder("ja").append("va").toString();
        System.out.println(str2.intern() == str2);

    }

}
